home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / gscript / gs261s.zoo / atari / gp_atari.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-03  |  7.5 KB  |  188 lines

  1. /* Copyright (C) 1989, 1992, 1993 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* gp_atari.h */
  20.  
  21. /* Ghostscript header file for the Atari platform. */
  22.  
  23. #include "memory_.h"
  24. #include "string_.h"
  25. #include "gx.h"
  26. #include "gp.h"
  27. #include "stat_.h"
  28. #include "time_.h"
  29. #include "gserrors.h"
  30. #include "gsmatrix.h"            /* for gxdevice.h */
  31. #include "gxdevice.h"
  32. #include "stream.h"
  33. #include "filedev.h"            /* must come after stream.h */
  34. #include "math_.h"
  35.  
  36. #include <stdlib.h>
  37. #include <stdarg.h>
  38. #include <gemdefs.h>
  39. #include <aesbind.h>
  40. #include <vdibind.h>
  41.  
  42. #define MIN(x, y) ((x <= y) ? x : y)
  43. #define MAX(x, y) ((x >= y) ? x : y)
  44.  
  45. #define ON    (1)
  46. #define OFF    (0)
  47. #define MAXLEN    (256)
  48.  
  49. #define WM_UNTOPPED    (30)
  50. #define WM_ONTOP    (31)
  51. #define COMMAND        (60)        /* New message type. */
  52.  
  53. #define INITLINES (13)
  54. #define LINES   (24)
  55. #define COLUMNS (80)
  56. #define CLIMIT    (COLUMNS + 2)
  57.  
  58. /* Definitions for GEM. */
  59.  
  60. #define W_GADGETS (NAME+CLOSER+MOVER+SIZER+FULLER+VSLIDE\
  61.             +HSLIDE+UPARROW+DNARROW+LFARROW+RTARROW)
  62. #define T_GADGETS (NAME+CLOSER+MOVER+SIZER+FULLER+VSLIDE\
  63.             +HSLIDE+UPARROW+DNARROW+LFARROW+RTARROW)
  64. #define I_GADGETS (NAME+MOVER+FULLER)
  65. #define D_GADGETS (CLOSER+NAME+MOVER)
  66.  
  67. #define W_TITL " GS Image "
  68. #define T_TITL " GS Console "
  69. #define I_TITL " GS "
  70. #define D_TITL " About ST-GS"
  71.  
  72. #define UL (unsigned long)
  73.  
  74. #define OK    9
  75. #define ABOUT    11
  76. #define RUN    20
  77. #define NEXT    21
  78. #define QUIT    22
  79. #define ICON    27
  80. #define TOGTOP    28
  81.  
  82. #define DIRT_RECT 0    /* Redraw only the dirty part of the window. */
  83. #define FULL_WIN  1    /* Redraw the full window. */
  84.  
  85. #define  DEFINED_INTENSITY        0
  86.  
  87. #define DITH_RGB(depth)\
  88.   (depth == 16 ? 40 : depth == 8 ? 6 : depth == 4 ? 2 : depth == 2 ? 2 : 1)
  89.  
  90. typedef struct window {
  91.     short handle;    /* window handle */
  92.     short gadgets;    /* which window gadgets are enabled */
  93.     short opened;    /* flag for window state */
  94.     char  *title;    /* pointer to window title */
  95.     GRECT canvas;    /* size of window work area */
  96.     GRECT frame;    /* sized of entire window */
  97.     GRECT oframe;    /* last frame size */
  98.     GRECT mframe;    /* maximum frame size */
  99.     int (*redraw)();    /* routine for window redraw */
  100. } WINDOW;
  101.  
  102. typedef struct textwin {
  103.     WINDOW *win;    /* pointer to an associated window structure */
  104.     char   text[LINES][COLUMNS+1];    /* text buffer */
  105.     short  top;        /* position of the top of page wrt screen */
  106.     short  edge;    /* position of the left edge of page wrt screen */
  107.     short  xoff, yoff;    /* offset of text wrt top left corner of page */
  108.     short  cx, cy;    /* cursor position in raster coordinates */
  109.     short  cstate;    /* cursor state (on/off) */
  110.     short  wc, hc;    /* width and height of the current font */
  111.     short  lins, cols;    /* width and height of the textwin in characters */
  112.     short  ln, cn;    /* the current line and column */
  113.     short  fl, ll;    /* first and last lines in the text buffer */
  114.     short  fdl, ldl;    /* first and last displayed lines */
  115.     short  fdc, ldc;    /* first and last displayed columns */
  116.     short  scrolled;    /* state of scrolling */
  117. } TEXTWIN;
  118.  
  119. /* Menu bar when windows are enabled. */
  120.  
  121. OBJECT menu[] = {
  122.  
  123. /* 0 */  {-1,  1,  9, G_IBOX,  0, 0, 0L,                   0, 0, 80,  25},
  124. /* 1 */  { 9,  2,  2, G_BOX ,  0, 0, 0x1100L,              0, 0, 80, 513},
  125.  
  126. /* 2 */  { 1,  3,  5, G_IBOX,  0, 0, 0L,                   2, 0, 20, 769},
  127. /* 3 */  { 4, -1, -1, G_TITLE, 0, 0, UL" ST-GS ",          0, 0,  7, 769},
  128. /* 4 */  { 5, -1, -1, G_TITLE, 0, 0, UL" File ",           7, 0,  6, 769},
  129. /* 5 */  { 2, -1, -1, G_TITLE, 0, 0, UL" Window ",        13, 0,  8, 769},
  130. /* 6 */  { 7, -1, -1, G_TITLE, 0, DISABLED, UL"",         21, 0, 10, 769},
  131. /* 7 */  { 8, -1, -1, G_TITLE, 0, DISABLED, UL"",         31, 0, 10, 769},
  132. /* 8 */  { 2, -1, -1, G_TITLE, 0, DISABLED, UL"",         41, 0, 10, 769},
  133.  
  134. /* 9 */  { 0,  10, 26, G_IBOX,  0, 0, 0L,                 0, 769, 80, 19},
  135.  
  136. /* 10 */  { 19, 11, 18, G_BOX ,  0, 0, 0xff1100L,            2, 0, 20, 8},
  137. /* 11 */  { 12, -1, -1, G_STRING ,  0, 0, UL"  About ST-GS", 0, 0, 20, 1},
  138. /* 12 */  { 13, -1, -1, G_STRING ,  0, 0x08, UL" ------------------ ",  0, 1, 20, 1},
  139. /* 13 */  { 14, -1, -1, G_STRING ,  0, 0, UL"1",             0, 2, 20, 1},
  140. /* 14 */  { 15, -1, -1, G_STRING ,  0, 0, UL"2",             0, 3, 20, 1},
  141. /* 15 */  { 16, -1, -1, G_STRING ,  0, 0, UL"3",             0, 4, 20, 1},
  142. /* 16 */  { 17, -1, -1, G_STRING ,  0, 0, UL"4",             0, 5, 20, 1},
  143. /* 17 */  { 18, -1, -1, G_STRING ,  0, 0, UL"5",             0, 6, 20, 1},
  144. /* 18 */  { 10, -1, -1, G_STRING ,  0, 0, UL"6",             0, 7, 20, 1},
  145.  
  146. /* 19 */  { 26, 20, 22, G_BOX ,  0, 0, 0xff1100L,                9, 0, 16, 3},
  147. /* 20 */  { 21, -1, -1, G_STRING ,  0, 0, UL"  Run        ❎r ", 0, 0, 16, 1},
  148. /* 21 */  { 22, -1, -1, G_STRING ,  0, 0, UL"  Next Page  ❎n ", 0, 1, 16, 1},
  149. /* 22 */  { 19, -1, -1, G_STRING ,  0, 0, UL"  Quit GS    ❎q ", 0, 2, 16, 1},
  150. /* 23 */  { 24, -1, -1, G_STRING ,  0, DISABLED, UL"",           0, 3, 16, 1},
  151. /* 24 */  { 25, -1, -1, G_STRING ,  0, DISABLED, UL"",           0, 4, 16, 1},
  152. /* 25 */  { 19, -1, -1, G_STRING ,  0, DISABLED, UL"",           0, 5, 16, 1},
  153.  
  154. /* 26 */  {  9, 27, 28, G_BOX ,  0, 0, 0xff1100L,              15, 0, 16, 2},
  155. /* 27 */  { 28, -1, -1, G_STRING ,  0, 0, UL"  Iconify    ❎i ", 0, 0, 16, 1},
  156. /* 28 */  { 26, -1, -1, G_STRING ,  0, 0, UL"  Toggle Top ❎t ", 0, 1, 16, 1},
  157. /* 29 */  { 30, -1, -1, G_STRING ,  0, DISABLED, UL"",         0, 2, 16, 1},
  158. /* 30 */  { 31, -1, -1, G_STRING ,  0, DISABLED, UL"",         0, 3, 16, 1},
  159. /* 31 */  { 32, -1, -1, G_STRING ,  0, DISABLED, UL"",         0, 4, 16, 1},
  160. /* 32 */  { 26, -1, -1, G_STRING ,  LASTOB, DISABLED, UL"",    0, 5, 16, 1}
  161.  
  162. };
  163.  
  164. /* About stvdi dialog object. */
  165.  
  166. OBJECT about[] = {
  167. /* 0 */  {-1,  1,  9,    G_BOX, 0, 16, 0x00021100L,           0, 0, 29, 15},
  168. /* 1 */  { 2, -1, -1, G_STRING, 0, 0, UL"Ghostscript Screen Driver", 2, 1, 25, 1},
  169. /* 2 */  { 3, -1, -1, G_STRING, 0, 0, UL"For The Atari ST",   6, 2, 16, 1},
  170. /* 3 */  { 4, -1, -1, G_STRING, 0, 0, UL"Tim Gallivan, 1993", 5, 3, 18, 1},
  171. /* 4 */  { 5, -1, -1, G_STRING, 0, 0, UL"Image Window Accelerators", 2, 5, 25, 1},
  172. /* 5 */  { 6, -1, -1, G_STRING, 0, 0, UL"\001\002: Page Up/Down",    5, 7, 16, 1},
  173. /* 6 */  { 7, -1, -1, G_STRING, 0, 0, UL"\004\003: Page Left/Right", 5, 8, 19, 1},
  174. /* 7 */  { 8, -1, -1, G_STRING, 0, 0, UL"Scroll Bar Arrows",    6, 10, 17, 1},
  175. /* 8 */  { 9, -1, -1, G_STRING, 0, 0, UL"Move to Page Edges.",  5, 11, 19, 1},
  176. /* 9 */  { 0, -1, -1, G_BUTTON, 0x62,  0, UL" OK ",            11, 13, 6, 1}
  177. };
  178.  
  179. #include "noghost.c"    /* File containing ghostscript icon definitions. */
  180.  
  181. /* Real versions of the following functions are needed in gp_atari. */
  182.  
  183. #undef fputc
  184. #undef fputs
  185. #undef fwrite
  186.  
  187. /* end gp_atari.h */
  188.